package com.topvision.service.api.impl.glass;

import com.topvision.mapper.glass.EquipmentMapper;
import com.topvision.mapper.glass.FaceAlarmMapper;
import com.topvision.mapper.glass.SysversionMapper;
import com.topvision.model.glass.FaceAlarm;
import com.topvision.model.glass.Sysversion;
import com.topvision.service.api.glass.AppFaceAlarmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("appFaceAlarmService")
public class AppFaceAlarmServiceImpl implements AppFaceAlarmService {

    @Autowired
    FaceAlarmMapper faceAlarmMapper;

    @Autowired
    EquipmentMapper equipmentMapper;

    @Override
    public FaceAlarm find(String faceNumber, String guid) {
        Map<String, Object> map = new HashMap<>();
        map.put("faceNumber", faceNumber);
        map.put("guid", guid);
        List<FaceAlarm> faceAlarms = faceAlarmMapper.queryByParam(map);
        if (faceAlarms != null && faceAlarms.size() > 0) {
            return faceAlarms.get(0);
        }
        return null;
    }

    @Override
    public void save(FaceAlarm faceAlarm) {
        faceAlarmMapper.save(faceAlarm);
    }

    @Override
    public void update(FaceAlarm entity) {
        faceAlarmMapper.update(entity);
    }
}
